<php>
    $formType = $item['form']['type'] ? $item['form']['type'] : 'select'; //默认下拉选择
    if($formType == 'select' && $item['option']['api']) $formType = 'api';
    if($formType == 'select2'){
</php>
<select class="form-control select2 {$item.form.class}" name="{$item.name}" {$item.form.attr} api="{$item['option']['api']}" default="{$item.value}"></select>
<php>
    }else if($formType == 'api'){
</php>
<select class="form-control {$item.form.class}" name="{$item.name}" {$item.form.attr} api="{$item['option']['api']}" default="{$item.value}"></select>
<php>
    }else if($formType == 'hidden'){
</php>
<input type="hidden" name="{$item.name}" value="{$item.value}">
<php>
    }else if($formType == 'static'){
    $titles = '';
    $values = '';
    if($item['option']['table']){
        $select = M($item['option']['table'])->where(array($item['option']['key']=>$data['id']))->select();
        $arrs = \Common\Util\ArrayUtil::getColumn($select, $item['option']['field']);
        $mlist = D($item['option']['model'])->where($item['option']['condition'])->where(array('id'=>array('in', $arrs)))->select();
        foreach($mlist as $r){
            $titles .= ','. $r[$item['option']['title']];
            $values .= ','. $r['id'];
        }
        $titles = substr($titles,1);
        $values = substr($values,1);
    }else{
        $values = $item['value'];
        $titles = D($item['option']['model'])->keyFind($item['value'],$item['option']['title']);
    }
</php>
<p class="form-control-static">{$titles}</p>
<input type="hidden" name="{$item.name}" value="{$values}">
<php>
    }else if($formType == 'select'){
</php>
<select class="form-control {$item.form.class}" name="{$item.name}" {$item.form.attr}>
    <option value="">--{$item['title']}--</option>
    <php>
            $mlist = D($item['option']['model'])->where($item['option']['condition'])->select();
            foreach($mlist as $vo){
    </php>
    <option value="{$vo.id}" <if condition="$vo['id'] eq $item['value']">selected</if> >{$vo[$item['option']['title']]}</option>
    <php>   }   </php>
</select>
<php>
    }else if($formType == 'radio'){
            $mlist = D($item['option']['model'])->where($item['option']['condition'])->select();
            foreach($mlist as $vo){
</php>

<label class="radio-inline">
    <input type="radio" {$item.form.class}" name="{$item.name}"  value="{$k}" <php>if($item['value'] == $k){echo 'checked';}</php> {$item.form.attr}> {$vo[$item['option']['title']]}
</label>
<php>
            }
    }else if($formType == 'checkbox'){
        $mlist = D($item['option']['model'])->where($item['option']['condition'])->select();
        $select = M($item['option']['table'])->where(array($item['option']['key']=>$data['id']))->select();
        $arrs = \Common\Util\ArrayUtil::getColumn($select, $item['option']['field']);
        foreach($mlist as $vo){
</php>
<label class="checkbox-inline">
    <input type="checkbox" class="{$item.form.class}" name="{$item.name}[]" value="{$vo['id']}" <php>if(in_array($vo['id'], $arrs)){echo 'checked';}</php> {$item.form.attr}>{$vo[$item['option']['title']]}
</label>
<php>
        }
    }
</php>